unit U_PersonelTalepKart;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FormClassEkran, ImgList, XPMan, StdActns, ActnList, fcStatusBar,
  StdCtrls, Buttons, ExtCtrls, DB, ADODB, Mask, wwdbedit, wwdblook,
  Wwdotdot, Wwdbcomb, wwdbdatetimepicker, wwcheckbox;

type
  TfmPersonelTalepKart = class(TfmFormClassEkran)
    dsEntry: TDataSource;
    aqEntry: TADOQuery;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    TalepYapanBirim: TwwDBLookupCombo;
    Label2: TLabel;
    TalepEdilenPoziyon: TwwDBEdit;
    Label3: TLabel;
    TalepTarih: TwwDBDateTimePicker;
    Label4: TLabel;
    TalepNedeni: TwwDBComboBox;
    Label5: TLabel;
    TalepNedenAciklama: TwwDBEdit;
    Label6: TLabel;
    CalismaSekli: TwwDBComboBox;
    Label7: TLabel;
    BaslamaTarihi: TwwDBDateTimePicker;
    Label8: TLabel;
    BitisTarihi: TwwDBDateTimePicker;
    Label9: TLabel;
    isinTanimi: TwwDBEdit;
    GroupBox2: TGroupBox;
    Label10: TLabel;
    Label11: TLabel;
    Meslegi: TwwDBEdit;
    Label12: TLabel;
    Deneyim: TwwDBEdit;
    Label13: TLabel;
    BilgiBeceri: TwwDBEdit;
    Label14: TLabel;
    Label15: TLabel;
    BilgisayarBilgisi: TwwDBEdit;
    Label16: TLabel;
    Askerlik: TwwDBEdit;
    Label17: TLabel;
    SurucuBelgesi: TwwDBEdit;
    YabanciDilDuzey: TwwDBComboBox;
    Label29: TLabel;
    Label30: TLabel;
    Label31: TLabel;
    YabanciDilDuzey1: TwwDBComboBox;
    YabanciDil: TwwDBComboBox;
    YabanciDil1: TwwDBComboBox;
    GroupBox3: TGroupBox;
    Label22: TLabel;
    GorevUnvani: TwwDBEdit;
    Label23: TLabel;
    Ucret: TwwDBEdit;
    Label24: TLabel;
    YanHaklar: TwwDBEdit;
    Label26: TLabel;
    DepartmanYonetici: TwwDBLookupCombo;
    Label27: TLabel;
    insanKaynaklari: TwwDBLookupCombo;
    Label28: TLabel;
    GenelMudur: TwwDBLookupCombo;
    Label18: TLabel;
    TercihEdilenOzellik: TwwDBEdit;
    ButceVarmi: TwwCheckBox;
    BaslamasiistenenTarih: TwwDBDateTimePicker;
    Label19: TLabel;
    Label20: TLabel;
    OnerilenUcret: TwwDBEdit;
    Label21: TLabel;
    TalepYapanYonetici: TwwDBLookupCombo;
    Label25: TLabel;
    iseBaslamaTarihi: TwwDBDateTimePicker;
    aqTalepYapanBirim: TADOQuery;
    EgitimDurumu: TwwDBComboBox;
    aqPersonel: TADOQuery;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
    procedure acKaydetYeniExecute(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure aqEntryAfterOpen(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmPersonelTalepKart: TfmPersonelTalepKart;

implementation
uses data, FormClass, U_PersonelTalep;
{$R *.dfm}

procedure TfmPersonelTalepKart.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  Action := caFree;
  fmPersonelTalepKart := nil;
end;

procedure TfmPersonelTalepKart.FormShow(Sender: TObject);
begin
  inherited;
  OpenQueryOnDataSet(aqEntry.SQL.Text, aqEntry, ['id'], [UseID]);

  if UseType in [futInsert] then
  begin
    aqEntry.Insert;
    ComponentRenklendir(Self, True);
  end;

  if UseType in [futEdit] then
  begin
    aqEntry.Edit;
    ComponentRenklendir(Self, True);
  end;

  if UseType in [futInspection] then
  begin
    ComponentRenklendir(Self, False);
  end;
end;

procedure TfmPersonelTalepKart.acKaydetYeniExecute(Sender: TObject);
begin
  inherited;
  aqEntry.Post;
  if (Sender as TAction).Tag = 2 then
  begin
    fmPersonelTalep.aqEntry.Requery;
    Close;
  end
  else
    if (Sender as TAction).Tag = 1 then
    begin
      UseID := '0';
      UseType := futInsert;
      FormShow(Sender);
    end;
end;

procedure TfmPersonelTalepKart.FormCreate(Sender: TObject);
begin
  inherited;
  OpenQueryOnDataSet(aqTalepYapanBirim.SQL.Text, aqTalepYapanBirim);
  OpenQueryOnDataSet(aqPersonel.SQL.Text, aqPersonel);
end;

procedure TfmPersonelTalepKart.aqEntryAfterOpen(DataSet: TDataSet);
begin
  inherited;
  TBCDField(DataSet.FieldByName('Ucret')).DisplayFormat := '0,.00';
  TBCDField(DataSet.FieldByName('OnerilenUcret')).DisplayFormat := '0,.00';
end;

end.

